#pragma once
#include "MeshLoader.h"
#include "SubMesh.h"
#include "VertexElement.h"
#include "Skeleton.h"

namespace DreamEngine
{
class CMeshLoader;

struct DefaultMeshVertex
{
	float x,  y,  z;
	float nx, ny, nz;
	float u, v;
};

class _EngineExport CMesh : public CEngineObject
{
public:

	typedef std::vector<CSubMesh*> SubMeshLst;

	CMesh(const CString& name);
	~CMesh(void);

	void				LoadFromFile(CMeshLoader* pMeshLoader, const std::string& fileName);
	void				Destory(void);

	void				AddSubMesh(CSubMesh* pSubMesh);
	const SubMeshLst&	GetSubMeshs(void)const				{return m_subMeshs;}

	const CString&		GetName(void)const					{return m_name;}

	CSkeleton*			GetSkeleton(void)const				{return m_pSkeleton;}

	static		CVertexElement DefaultMeshElem[3];

protected: 

	SubMeshLst			m_subMeshs;
	CString				m_name;

	CSkeleton*			m_pSkeleton;
};

}


